package com.example.springvue.common.returnthrow;

import lombok.Getter;
import lombok.ToString;
import org.springframework.http.HttpStatus;

@ToString
@Getter
public enum ResultStatus {

    SUCCESS(HttpStatus.OK, 200),
    CREATED(HttpStatus.CREATED, 201),
    BAD_REQUEST(HttpStatus.BAD_REQUEST, 400),//错误的请求
    UNAUTHORIZED(HttpStatus.UNAUTHORIZED,401),//未登录

    INTERNAL_SERVER_ERROR(HttpStatus.INTERNAL_SERVER_ERROR, 500),;//内部服务器错误
    /** 返回的HTTP状态码,  符合http请求 */
    private HttpStatus httpStatus;
    /** 业务异常码 */
    private Integer code;


    ResultStatus(HttpStatus httpStatus, Integer code) {
        this.httpStatus = httpStatus;
        this.code = code;
    }
}
